import request from '@/utils/axios';

import type { UserInfo, LoginData } from './types';

export const getCaptchaApi = () => {
  return request.get({ url: '/system/authorization/getCaptcha' });
};

export const loginApi = (data: LoginData): Promise<UserInfo> => {
  return request.post({ url: '/system/authorization/login', data });
};

export const logoutApi = (): Promise<boolean> => {
  return request.get({ url: '/system/authorization/logout' });
};

export const updatePwApi = (password: string) => {
  return request.post({
    url: '/system/authorization/updatePassword',
    params: { password },
  });
};
